package com.seezoon.infrastructure.tcp.jt808;

import com.seezoon.infrastructure.tcp.common.MessageField;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * @see com.seezoon.infrastructure.tcp.codec.JT808#平台通用应答
 */
@Getter
@Setter
@ToString
public class JT8001 {

    @MessageField(desc = "对应终端消息流水号")
    private int responseMsgSerialNo;

    @MessageField(desc = "对应终端消息ID")
    private int msgId;

    @MessageField(desc = "结果")
    private short resultCode;

    public boolean isSuccess() {
        return resultCode == ResultCode.SUCCESS;
    }

    public static class ResultCode {

        public static final short SUCCESS = 0; //成功、确认
        public static final short FAILURE = 1;//失败
        public static final short MESSAGEERROR = 2;//消息有误
        public static final short NOT_SUPPORT = 3;//不支持
        public static final short ALARM_ACK = 4;//报警处理确认
    }
}
